<?php
require_once("../../../config.inc.php");
$isReloadable = false;
require_once("../../../app/_inc/include.php");
require_once("./_inc/layoutFunction.php");

$errMsg = "";
$layout = sxREQUEST("layout");
$band = sxREQUEST("band");

if(sxREQ("reqtype") == "delete"){
	$errMsg .= layoutBandDel();
}
$sSQL = "SELECT * FROM layout_band " .
			" WHERE layout='$layout' " .
			" AND band='$band' ";
$objSDAO->query($sSQL,"sel");
if(!$row = $objSDAO->fetch("sel")){
	$errMsg .= _t("no band '%s'",sxREQ('layout')."/".sxREQ('band'))."<br>";
	$url = $_SESSION[USEROBJ]->getHistory(0, true)."&msg=".urlencode($errMsg);
	serverRedir($url);
}			
sxRDef('band', $row['band']);
sxRDef('description', $row['description']);
sxRDef('display_only', $row['display_only']);
sxRDef('flags', $row['flags']);
sxRDef('note', $row['note']);
sxRDef('upgrade_status', $row['upgrade_status']);

$aOpz = array("kMenu"=>'pro.lay', "isReloadable"=>$isReloadable);
echo(headerHTML($aOpz));
?>
<script language="JavaScript" type="text/javascript">
function confDel(){
	if (confirm("Confirm ?")) {
		document.location.href = 
			"layoutBandView?reqtype=delete<?="&layuot=$layout&band=$band&xsn=".XSN?>";
	}
}
</script>
  
<?php
echo(bodyHTML($aOpz));

echo getLOHeader($layout);

$aCmd = array("delete"=>array("pag"=>"javascript:confDel();",
										"title"=>_t("delete"),
										"text"=>_t("delete")
										),
					"change"=>array("pag"=>"layoutBandMod.php?layuot=$layout&band=$band",
										"title"=>_t("change"),
										"text"=>_t("change")
										),
					"back"=>array()
					);
echo(commandsHTML($aCmd));	

echo("<table class=\"tabl01\" width=\"100%\" cellpadding=\"3\" cellspacing=\"2\" border='0'>\n");
echo("<tr>" .
			"<td class=\"titl01\" width=\"20%\" colspan='2'>Layout Band</td>" .
		"</tr>\n");
echo("<tr>" .
			"<td class=\"labl01\">Band*</td>" .
			"<td class=\"text01\">".
			sxREQ('band')."</td>" .
		"</tr>\n");
echo("<tr>" .
			"<td class=\"labl01\">Description</td>" .
			"<td class=\"text01\">".sxREQ('description')."</td>" .
		"</tr>\n");
$aValDO = array('Y'=>'Yes','N'=>'No');
echo("<tr>" .
			"<td class=\"labl01\">Display only</td>" .
			"<td class=\"text01\">".$aValDO[sxREQ('display_only')].
		"</td>\n</tr>\n");
echo("<tr>" .
			"<td class=\"labl01\">Flags</td>" .
			"<td class=\"text01\">".sxREQ('flags')."</td>" .
		"</tr>\n");
echo("<tr>" .
			"<td class=\"labl01\">Note</td>" .
			"<td class=\"text01\">".nl2br(sxREQ('note'))."</td>" .
		"</tr>\n");
echo("</table>");

echo(commandsHTML($aCmd));
echo(footerHTML());
exit();

function layoutBandDel(){
 	global $objSDAO;
	$errMsg = "work in progress";
	
	if($errMsg != ""){return $errMsg;}	

	$sSQL = "DELETE FROM layout_band " .
			" WHERE layout='".sxRAS('layout')."' " .
			" AND band=".sxRAS('band')."";	
	$objSDAO->query($sSQL,"del");
	
	$url = $_SESSION[USEROBJ]->getHistory(0, true);
	serverRedir($url);
	return 'abnormal end';
}
